package bao;

import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import resume.Resumej;

import util.dao.Pagination;

import com.opensymphony.xwork2.ActionSupport;

public class BaoAction extends ActionSupport{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private BaoDao baoDao;
	
	private Bao bao;
	
	private Pagination<Bao> pagination;
	
	private Long id;
	
	

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Pagination<Bao> getPagination() {
		return pagination;
	}

	public void setPagination(Pagination<Bao> pagination) {
		this.pagination = pagination;
	}
    
	
	public Bao getBao() {
		return bao;
	}

	public void setBao(Bao bao) {
		this.bao = bao;
	}

	public BaoDao getBaoDao() {
		return baoDao;
	}

	public void setBaoDao(BaoDao baoDao) {
		this.baoDao = baoDao;
	}
	
	public BaoAction(){
		this.pagination = new Pagination<Bao>();
		this.pagination.setSize(5);
		this.pagination.setNo(1);
	}
	@Transactional(propagation=Propagation.SUPPORTS)
	
	public String login() throws Exception{
		
		return SUCCESS;
		
	}
	
	public String saveorupdate() throws Exception{
		baoDao.saveOrUpdate(bao);
		return SUCCESS;
		
	}
	
	public String browse() throws Exception{
		baoDao.browse(pagination);
		return SUCCESS;
	}
	
	public String update() throws Exception{
		this.bao=baoDao.findById(this.bao.getId());
		return SUCCESS;
	}
	
	public String delete() throws Exception{
		baoDao.delete(bao);
		return SUCCESS;
	}

}
